package com.ruoyi.web.ydz.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.ydz.mapper.OtherNewsDiseaseMapper;
import com.ruoyi.web.ydz.domain.OtherNewsDisease;
import com.ruoyi.web.ydz.service.IOtherNewsDiseaseService;

/**
 * 其他新闻疾病Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-14
 */
@Service
public class OtherNewsDiseaseServiceImpl implements IOtherNewsDiseaseService 
{
    @Autowired
    private OtherNewsDiseaseMapper otherNewsDiseaseMapper;

    /**
     * 查询其他新闻疾病
     * 
     * @param id 其他新闻疾病主键
     * @return 其他新闻疾病
     */
    @Override
    public OtherNewsDisease selectOtherNewsDiseaseById(Long id)
    {
        return otherNewsDiseaseMapper.selectOtherNewsDiseaseById(id);
    }

    /**
     * 查询其他新闻疾病列表
     * 
     * @param otherNewsDisease 其他新闻疾病
     * @return 其他新闻疾病
     */
    @Override
    public List<OtherNewsDisease> selectOtherNewsDiseaseList(OtherNewsDisease otherNewsDisease)
    {
        return otherNewsDiseaseMapper.selectOtherNewsDiseaseList(otherNewsDisease);
    }

    /**
     * 新增其他新闻疾病
     * 
     * @param otherNewsDisease 其他新闻疾病
     * @return 结果
     */
    @Override
    public int insertOtherNewsDisease(OtherNewsDisease otherNewsDisease)
    {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        otherNewsDisease.setCreateBy(user.getUserName());
        otherNewsDisease.setCreateName(user.getNickName());
        otherNewsDisease.setCreateTime(DateUtils.getNowDate());
        return otherNewsDiseaseMapper.insertOtherNewsDisease(otherNewsDisease);
    }

    /**
     * 修改其他新闻疾病
     * 
     * @param otherNewsDisease 其他新闻疾病
     * @return 结果
     */
    @Override
    public int updateOtherNewsDisease(OtherNewsDisease otherNewsDisease)
    {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        otherNewsDisease.setUpdateBy(user.getNickName());
        otherNewsDisease.setUpdateName(user.getUserName());
        otherNewsDisease.setUpdateTime(DateUtils.getNowDate());
        return otherNewsDiseaseMapper.updateOtherNewsDisease(otherNewsDisease);
    }

    /**
     * 批量删除其他新闻疾病
     * 
     * @param ids 需要删除的其他新闻疾病主键
     * @return 结果
     */
    @Override
    public int deleteOtherNewsDiseaseByIds(Long[] ids)
    {
        return otherNewsDiseaseMapper.deleteOtherNewsDiseaseByIds(ids);
    }

    /**
     * 删除其他新闻疾病信息
     * 
     * @param id 其他新闻疾病主键
     * @return 结果
     */
    @Override
    public int deleteOtherNewsDiseaseById(Long id)
    {
        return otherNewsDiseaseMapper.deleteOtherNewsDiseaseById(id);
    }
}
